﻿using System;
using NCommet.Core.Agents;

namespace NCommet.Core.Exceptions
{
    /// <summary>
    /// <c>AuthException</c> is an exception thrown when authorization fails on some operation.
    /// </summary>
    [Serializable]
    public class AuthException : Exception
    {
        private AccessLevel requiredAccessLevel;

        /// <summary>
        /// The required access level for the failed operation.
        /// </summary>
        public AccessLevel RequiredAccessLevel
        {
            get { return requiredAccessLevel; }
        }

        /// <summary>
        /// Creates a new <c>AuthException</c>.
        /// </summary>
        /// <param name="requiredAccessLevel">The required access level for the failed operation.</param>
        /// <param name="message">The exception message.</param>
        /// <param name="inner">The inner exception.</param>
        public AuthException(AccessLevel requiredAccessLevel, string message, Exception inner) : base(message, inner) { this.requiredAccessLevel = requiredAccessLevel; }
    }
}
